<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="../include/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>商品列表页面</title>
<%@ include file="../include/easyui.jsp"%>
</head>
<body>
<div>
	<form id="mainform" action="${ctx}/product/item/${action}" method="post">
	<table  class="formTable">
		<c:if test="${action == 'update'}">
			<input type="hidden" name="id" value="${id }" />
		</c:if>
		<tr>
			<td>标题：</td>
			<td><input id="title" name="title" type="text" value="${product.title}" class="easyui-validatebox" data-options="width: 150" /></td>
		</tr>
		<tr>
			<td>卖点：</td>
			<td><input id="sellPoint" name="sellPoint" type="text" value="${product.sellPoint}" class="easyui-validatebox" data-options="width: 150" /></td>
		</tr>
		<tr>
			<td>价格：</td>
			<td><input id="price" name="price" type="text" value="${product.price}" class="easyui-numberbox" data-options="width: 150" /></td>
		</tr>
		<tr>
			<td>库存：</td>
			<td><input id="num" name="num" type="text" value="${product.num}" class="easyui-numberbox" data-options="width: 150" /></td>
		</tr>
		<tr>
			<td>类目：</td>
			<td><input id="cid" name="cid" type="text" value="${product.cid}" class="easyui-validatebox" data-options="width: 150" /></td>
		</tr>
		<tr>
			<td>状态：</td>
			<td><input id="status" name="status" type="text" value="${product.status}" class="easyui-validatebox" data-options="width: 150" /></td>
		</tr>
	</table>
	</form>
</div>

<script type="text/javascript">
var action="${action}";
$(function(){
	$('#mainform').form({    
	    onSubmit: function(){    
	    	var isValid = $(this).form('validate');
			return isValid;	// 返回false终止表单提交
	    },    
	    success:function(data){
			var data = eval('(' + data + ')');
	    	successTip(data.message,dg,dialog);
	    }    
	}); 
});
</script>

</body>
</html>